<template>
	<view class="allCase">
		<view class="grid">
			<van-grid>
				<van-grid-item class="gridItem" v-for="item in gridList" :key="item.id" :icon="item.url"
					:text="item.name" @click="gridClick(item)" />
			</van-grid>
		</view>
	</view>
</template>

<script>
	import { fileById } from '@/api/common'
	export default {
		name: 'allCase',
		data() {
			return {
				gridList: []
			}
		},
		created() {
			this.getGridList()
		},
		methods: {
			getGridList() {
				let arr = this.$storage.getItem('diseaseList');
				if (arr.length) {
					arr.map(item => {
						if (item.imgTheme) {
							fileById({ fileId: item.imgTheme }).then(res => {
								this.$set(item,'url', res.data.accessUrl);
							})
						}
					})
					this.gridList = arr
				}
			},
			gridClick(item) {
				let route = `/packageA/pages/signUp/index?data=${JSON.stringify(item)}`
				uni.navigateTo({
					url: route
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.allCase {
		padding: 40rpx 50rpx;
		.grid {
			width: 100%;
			padding: 0 0 20rpx;
			box-sizing: border-box;
			/deep/ .van-grid-item__icon {
				font-size: 100rpx;
			}
			/deep/ .van-grid-item__text {
				font-size: 26rpx;
			}
		}
	}
</style>
